/*
 * ScrollableWindow.h
 *
 *  Created on: 2012-11-9
 *      Author: yangentao@gmail.com
 */

#ifndef SCROLLABLEWINDOW_H_
#define SCROLLABLEWINDOW_H_
#include "Window.h"

class ScrollInfo {
public:
	ScrollInfo();
public:
	int minPos;
	int maxPos;
	int pageSize;
	int pos;
	int trackPos;
};

class ScrollableWindow: public Window {
	typedef Window Super;
public:
	ScrollableWindow();
	virtual ~ScrollableWindow();
public:
	ScrollInfo getHScrollInfo();
	ScrollInfo getVScrollInfo();
public:
	void setHScrollPos(int pos);
	void setHScrollMinMax(int minPos, int maxPos);
	void setHScrollPageSize(int pageSize);
	void setVScrollPos(int pos);
	void setVScrollMinMax(int minPos, int maxPos);
	void setVScrollPageSize(int pageSize);
public:
	void updateHScroll(bool disableWhenUnnecessary = true);
	void updateVScroll(bool disableWhenUnnecessary = true);
	void updateScrolls(bool disableWhenUnnecessary = true);

public:
	void showHScrollBar(bool show);
	void showVScrollBar(bool show);
	void showScrollBars(bool show);
private:
	ScrollInfo hScroll;
	ScrollInfo vScroll;

};


//--------------------------inline implements----------------------

inline ScrollInfo::ScrollInfo() {
	minPos = 0;
	maxPos = 0;
	pageSize = 0;
	pos = 0;
	trackPos = 0;
}

#endif /* SCROLLABLEWINDOW_H_ */
